#include <Object.hpp>

using namespace Olorin::Framework;

namespace Olorin
{
	Object::Object()
	{
		position = Vector3(); //Vector3::Zero;
		rotation = Quaternion(); //Quaternion::Identity;
	}

	Object::Object(const Vector3& position, const Quaternion& rotation)
	{
		this->position = position;
		this->rotation = rotation;
	}

	// Mutators
	void Object::setPosition(const Vector3& position)
	{
		this->position = position;
	}

	void Object::setRotation(const Quaternion& rotation)
	{
		this->rotation = rotation;
	}

	// Accessors
	const Vector3& Object::getPosition() const
	{
		return position;
	}

	const Quaternion& Object::getRotation() const
	{
		return rotation;
	}

	// Functions to manipulate rotation
	void Object::rotateQuaternion(const Quaternion& rotation)
	{
		this->rotation = rotation * this->rotation;
	}

	void Object::rotateAxisAngle(const Vector3& axis, const float& angle)
	{
		rotateQuaternion(Quaternion::createFromAxisAngle(axis, angle));
	}

	void Object::rotateX(const float& angle)
	{
		rotateQuaternion(Quaternion::createFromAxisAngle(Vector3(1,0,0), angle));
	}

	void Object::rotateY(const float& angle)
	{
		rotateQuaternion(Quaternion::createFromAxisAngle(Vector3(0,1,0), angle));
	}

	void Object::rotateZ(const float& angle)
	{
		rotateQuaternion(Quaternion::createFromAxisAngle(Vector3(0,0,1), angle));
	}
}